<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@taglib uri="/struts-tags" prefix="s" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/transition/transition.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/transition/demo.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/Implementation/implementation.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/Usuario/adminUsers.js"></script>

        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/estilo.css" />
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/stylSergio.css" />
        <title>Users</title>
    </head>
    <body>

        <div style="position: fixed; top: 0; z-index: 1; left:9%;">
            <s:div cssClass="contenidoAzul">
                <jsp:include page="/jsp/encabezado.jsp" flush="true" />
                <jsp:include page="/jsp/menu.jsp" flush="true" />
            </s:div> 
        </div>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        <s:div cssClass="contenidoBlancoEdit">
            <s:form action="Usuarios" theme="simple" id="adduser" name="adduser">
                <fieldset style="height: 500px">
                    <legend>
                        <s:label key="User" />
                    </legend>
                    <table style="width: 100%; margin-top: 40px" border="0">
                        <tr>
                            <td style="text-align: left; width: 15%">
                                <s:label key="User:" cssClass="labelFormat" />
                            </td>
                            <td style="width: 20%">
                                <s:textfield id="idTxtNombre"  maxLength="20" name="username" cssClass="textField" />
                            </td>
                            <td style="width: 20%">&nbsp;</td>
                            <td rowspan="2" style="40%">
                                <table style="width: 100%">
                                    <tr>
                                        <td>
                                            <input type="radio" value="Insertar Localidad"
                                                   name="nombreOpcionesRadioUsuarios"
                                                   onclick="ocultarBotonesUsuarios('Insertar Usuario');" checked="checked" />
                                            <label class="labelFormat">Add User</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <input type="radio" value="Buscar Localidad"
                                                   name="nombreOpcionesRadioUsuarios"
                                                   onclick="ocultarBotonesUsuarios('Buscar Usuario');"/>
                                            <label class="labelFormat">Search User</label>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr id="idPassword" class="ocultable">
                            <td style="text-align: left">
                                <s:label value="Password:"  cssClass="labelFormat insertar" />
                            </td>
                            <td>
                                <s:password id="idPaswoord" maxLength="20" name="pwd" cssClass="textField insertar" />
                            </td>
                            <td colspan="3">&nbsp;</td>
                        </tr>
                        <tr id="idMail">
                            <td style="text-align: left">
                                <s:label value="Mail:"  cssClass="labelFormat insertar"/>
                            </td>
                            <td>
                                <s:textfield id="idCorreo" maxLength="100"  name="email" cssClass="textField insertar" />
                            </td>
                            <td>
                                
                            </td>
                            <td>&nbsp;</td>
                        </tr>                 
                        <tr>
                            <td colspan="2" style="text-align: left">
                                <fieldset class="fieldSet" id="fsTran">
                                    <legend>Transition</legend>
                                    <input type="radio" name="Tran" value="RO">
                                    <label>Read Only</label></br></br>
                                    <input type="radio" name="Tran" value="E">
                                    <label>Edit</label></br></br>
                                    <input type="radio" name="Tran" value="NA" checked="true">
                                    <label>No Access</label></br>
                                </fieldset>
                            </td>
                            <td style="text-align: left">
                                <fieldset class="fieldSet" id="fsImp">
                                    <legend>Implementation</legend>
                                    <input type="radio" name="Imp" value="RO">
                                    <label>Read Only</label></br></br>
                                    <input type="radio" name="Imp" value="E">
                                    <label>Edit</label></br></br>
                                    <input type="radio" name="Imp" value="NA" checked="true">
                                    <label>No Access</label></br>
                                </fieldset>
                            </td>
                            <td align="right">
                                <fieldset class="fieldSet" style="text-align: left" id="fsCop">
                                    <legend>COP</legend>
                                    <input type="radio" name="Cop" value="RO">
                                    <label>Read Only</label></br></br>
                                    <input type="radio" name="Cop" value="E">
                                    <label>Edit</label></br></br>
                                    <input type="radio" name="Cop" value="NA" checked="true">
                                    <label>No Access</label></br>
                                </fieldset>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: left">
                                <fieldset class="fieldSet" id="fsSu">
                                    <legend>Super User</legend>
                                    </br>
                                    <s:checkbox name="SUA"/>
                                    <s:label value="All" />
                                </fieldset>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5" style="text-align: center">
                                <!--<button type="button" id="btnNuevo" class="megaBoton loginBoton" onclick="save(idTxtNombre.value,idPaswoord.value,idCorreo.value);" >Save</button>-->
                                <button type="button" id="btnNuevo" class="megaBoton loginBoton" onclick="saves();" >Save</button>
                                <button type="button" id="btnBuscar" class="megaBoton loginBoton" onclick="search();">Search</button>
                                <%--<s:submit id="botonNuevo" key="usuario.nuevo.prop" cssClass="escondido"--%> 
                                          <!--name="buttonAction" method="GetUsersWithSameNameAndEmail" />-->
                                <s:submit id="botonBuscar" key="usuario.boton.buscar.prop" cssClass="escondido" 
                                          name="buttonAction" cssStyle="display: none;" method="GetUsersByName" />
                                <s:submit id="botonNew" cssClass="escondido" 
                                          name="buttonAction" cssStyle="display: none;" method="SaveNewUser" />
                            </td>
                        </tr>
                    </table>
                </fieldset>
                <script>
                    jQuery("#btnBuscar").hide();
                  
                    function ocultarBotonesUsuarios(value) {
                        if (value == "Insertar Usuario") {
                            jQuery("#idType").show();
                            jQuery("#idType1").show();
                            jQuery("#idType2").show();
                            jQuery("#idType3").show();
                            jQuery("#idType4").show();
                            jQuery("#idType5").show();
                            jQuery("#idMail").show();
                            jQuery("#idPassword").show();
                            jQuery("#btnNuevo").show();
                            jQuery("#fsTran").show();
                            jQuery("#fsImp").show();
                            jQuery("#fsCop").show();
                            jQuery("#fsSu").show();
                            jQuery("#btnBuscar").hide();
                        } else if (value == "Buscar Usuario"){
                            jQuery("#idType").hide();
                            jQuery("#idType1").hide();
                            jQuery("#idType2").hide();
                            jQuery("#idType3").hide();
                            jQuery("#idType4").hide();
                            jQuery("#idType5").hide();
                            jQuery("#idMail").hide();
                            jQuery("#idPassword").hide();
                            jQuery("#btnBuscar").show();
                            jQuery("#btnNuevo").hide();
                            jQuery("#fsTran").hide();
                            jQuery("#fsImp").hide();
                            jQuery("#fsCop").hide();
                            jQuery("#fsSu").hide();
        
                        }
                    }
                    function search(){
                        $("#botonBuscar").click();
                    }
                </script>
            </s:form>
        </s:div>
    </body>
</html>